Skip to content

Enable make test#20

Open
HannoSpreeuw wants to merge 4 commits into
masterfrom
enable_make_test
Open

Enable make test#20
HannoSpreeuw wants to merge 4 commits into
masterfrom
enable_make_test

Conversation

@HannoSpreeuw

@HannoSpreeuw HannoSpreeuw commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

This is cherry-picked commit c1292cb (now commit 17fb33e) - Add 'make test' target to build and run correctness tests -
plus commit c1adf9d - Try to get an NVIDIA GPU if available.

make clean; make all; clear; make test works,
i.e.
make clean; make all BACKEND=CUDA; make test BACKEND=CUDA completes without error.

However, make clean; make all BACKEND=OpenCL; make test BACKEND=OpenCL yields

=== Running test_gravity_block_ocl ===
n = 1024
./test_gravity_block_ocl is using: n: 1024 Devices: 0 IntegrationOrder: 1 IntegrationPrecision: 1 File: OpenCL/kernels4th.cl
Integration order used: 1 (0=GRAPE5, 1=4th, 2=6th, 3=8th)
Integration precision used: 1 (0=FLOAT, 1 = DOUBLESINGLE, 2=DOUBLE)
Getting list of OpenCL devices ...
0: NVIDIA CUDA
Using platform 0
Found 1 suitable devices:
0: NVIDIA RTX A5000 Vendor: NVIDIA Corporation
Number of cpus available: 48
Number of gpus available: 1
integrationOrder : 1
Getting list of OpenCL devices ...
0: NVIDIA CUDA
Using platform 0
Found 1 suitable devices:
0: NVIDIA RTX A5000 Vendor: NVIDIA Corporation
Using device: 0
Device has: 64 multiprocessors
Using 16 blocks per multi-processor for a total of : 1024
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
1 warning generated.
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
1 warning generated.
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
1 warning generated.
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
1 warning generated.
Kernel files found .. building compute kernels!
Creating kernel dev_copy_particles
Maximum work group size: 256 Optimal work group multiple: 32
Creating kernel dev_predictor
Maximum work group size: 256 Optimal work group multiple: 32
Creating kernel dev_evaluate_gravity_fourth_DS
Maximum work group size: 256 Optimal work group multiple: 32
Creating kernel dev_reset_buffers
Maximum work group size: 256 Optimal work group multiple: 32
oclSafeCall() Runtime API error in file <src/ocldev.h>, line 546 : Out of resources
.
test_gravity_block_ocl: src/ocldev.h:179: void dev::__oclsafeCall(cl_int, const char*, int): Assertion `false' failed.
/bin/sh: line 1: 1892320 Aborted (core dumped)

when run on a cluster node with a NVIDIA RTX A5000 GPU after module load opencl-nvidia/12.3 on a cluster node when it gets to running test_gravity_block_ocl.

That same command will result in test_gravity_block_ocl running "forever" - i.e. until it is killed - at 100% utilisation on a machine with CUDA 13.2 - more specifically , nvcc --version gives cuda_13.2.r13.2/compiler.37668154_0 - and a NVIDIA RTX 4090 GPU:

=== Running test_gravity_block_ocl ===
n = 1024
./test_gravity_block_ocl is using: n: 1024 Devices: 0 IntegrationOrder: 1 IntegrationPrecision: 1 File: OpenCL/kernels4th.cl
Integration order used: 1 (0=GRAPE5, 1=4th, 2=6th, 3=8th)
Integration precision used: 1 (0=FLOAT, 1 = DOUBLESINGLE, 2=DOUBLE)
Getting list of OpenCL devices ...
0: AMD Accelerated Parallel Processing
1: NVIDIA CUDA
Found NVIDIA platform at index 1, preferring it over others.
Using platform 1
Found 1 suitable devices:
0: NVIDIA GeForce RTX 4090 Vendor: NVIDIA Corporation
Number of cpus available: 24
Number of gpus available: 1
integrationOrder : 1
Getting list of OpenCL devices ...
0: AMD Accelerated Parallel Processing
1: NVIDIA CUDA
Found NVIDIA platform at index 1, preferring it over others.
Using platform 1
Found 1 suitable devices:
0: NVIDIA GeForce RTX 4090 Vendor: NVIDIA Corporation
Using device: 0
Device has: 128 multiprocessors
Using 16 blocks per multi-processor for a total of : 2048
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
Loading file: OpenCL/kernels4th.cl
Opening kernel file: OpenCL/kernels4th.cl
Kernel files found .. building compute kernels!
Creating kernel dev_copy_particles
Maximum work group size: 256 Optimal work group multiple: 32
Creating kernel dev_predictor
Maximum work group size: 256 Optimal work group multiple: 32
Creating kernel dev_evaluate_gravity_fourth_DS
Maximum work group size: 256 Optimal work group multiple: 32
Creating kernel dev_reset_buffers
Maximum work group size: 256 Optimal work group multiple: 32
calchalf2: 0 0.057310 0.063280 0.044715 -0.078169 -0.166680 -0.461248 -0.214907 513 0.075619
calchalf2: 1 0.076777 0.051825 0.003352 -0.163508 1.554290 0.281493 -0.334387 802 0.041755
...
...
Computing forces on GPU
cycle= 0 dn= 607 ....

I have spent some time trying to fix this, but I did not succeed. Since OpenCL is not used often in AMUSE, I propose to merge.

v1kko and others added 4 commits June 1, 2026 20:35
Add a top-level `test` target that builds the library and the test
programs against it, then runs the GPU-vs-CPU correctness tests for the
4th-order, GRAPE5 (2nd-order) and 6th-order integrators. The target
dispatches to the CUDA or OpenCL test Makefile based on the selected
BACKEND, and sets LD_LIBRARY_PATH so the freshly built shared libraries
are found at runtime. A `build-tests` target is also provided to compile
the tests without running them, and `clean` now also cleans the tests
directory.

Fix two pre-existing bugs in tests/Makefile_ocl that prevented the
OpenCL tests from building/running: link against libsapporo2 (not the
old libsapporo name) and symlink kernels from src/OpenCL.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant